package com.eight.controller;

import com.eight.entity.Courseware;
import com.eight.service.impl.CoursewareServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//下面这个注解必须加，，起描述性作用
@Api(description = "课件模块")
@RestController
@RequestMapping("/CoursewareCenter")
public class CoursewareController {
    @Autowired
    CoursewareServiceImpl service;
//下面这个注解必须加，，起描述性作用
    @ApiOperation(value = "查询所有",httpMethod = "GET")
    @GetMapping("/Courseware")
    public List<Courseware> findAll(){
//       调用service层的findAll方法
        List<Courseware> all = service.findAll();
        return all;
    }

    @ApiOperation(value = "添加一个实体对象",httpMethod = "GET")
    @GetMapping("/Courseware")
    public int insert(Courseware courseware){
//       调用service层的findAll方法
        int insert = service.insert(courseware);
        return insert;
    }

}

